package action

import java.util.concurrent.CompletionStage

import akka.actor.Actor
import akka.event.Logging

import scala.collection.mutable

/**
 * @Description: TODO
 * @Author: DJJ
 * @Date: 2019/12/3 9:52
 */
class AkkademyDb extends Actor {

  val map = mutable.Map[String, Any]()
  val log = Logging(context.system, this)

  override def receive: Receive = {
    case SetRequest(key, value) => {
      if (!map.contains(key)) {
        log.info("SetRequest receive-key:{},value:{}", key, value)
        map.put(key, value)
      }
    }
    case "ping" => {
      sender() ! "pong"
/*      context.stop(self)
      context.system.terminate()*/
    }
    case _ =>
  }
}
